import Taro, { Component } from '@tarojs/taro'
import { Provider } from '@tarojs/redux'
import Index from './pages/index'
import configStore from './store'
import { setGlobalData } from './util/globaldata';
import './app.scss';
import './theme_color.scss';
// 如果需要在 h5 环境中开启 React Devtools
// 取消以下注释：
// if (process.env.NODE_ENV !== 'production' && process.env.TARO_ENV === 'h5')  {
//   require('nerv-devtools')
// }
/**
 * 1:订单详情改成  接单时间改成行程时间，点击开始行程的那个时间、
 * 2：接单时候已接单6次，详情已出行0次
 * 3：
*/
const store = configStore()

class App extends Component {
  config = {
    pages: [
      'pages/tabmain/tabmain',
      'pages/commentList/commentList',
      'pages/bindphone/bindphone',
      'pages/map/map',
      'pages/applyThree/applyThree', 
      'pages/applyTwo/applyTwo',
      'pages/applyOne/applyOne',
      'pages/loginRole/loginRole',
      'pages/loginXieyi/loginXieyi',
      'pages/login/login',
      'pages/driverorderdtl/driverorderdtl',
      'pages/driverjiedan/driverjiedan',
      'pages/tablist/tablist',
      'pages/moneycard/moneycard',
      'pages/suggest/suggest',
      'pages/idauth/idauth',
      'pages/idauthUser/idauthUser',
      'pages/about/about',
      'pages/question/question',
      'pages/orderdtl/orderdtl',
      'pages/orderlist/orderlist',
      'pages/tabuser/tabuser',
      'pages/confirmorder/confirmorder',
      'pages/oftenaddressadd/oftenaddressadd',
      'pages/receipt/receipt',
      'pages/cashier/cashier',
      'pages/createdorder/createdorder',
      'pages/userinfo/userinfo',
      'pages/oftenaddress/oftenaddress',
    ],
    window: {
      backgroundTextStyle: 'light',
      navigationBarBackgroundColor: '#fff',
      navigationBarTitleText: '出行小程序',
      navigationBarTextStyle: 'black'
    },
    tabBar:{
      color:"#999999",
      selectedColor:"#45A065",
      list:[
        {
          pagePath:"pages/tabmain/tabmain",
          text:"首页",
          iconPath:"image/page1.png",
          selectedIconPath:"image/page1_active.png",
        },
        {
          pagePath:"pages/tablist/tablist",
          text:"列表",
          iconPath:"image/page2.png",
          selectedIconPath:"image/page2_active.png",
        },
        {
          pagePath:"pages/tabuser/tabuser",
          text:"我的",
          iconPath:"image/page3.png", 
          selectedIconPath:"image/page3_active.png",
        },
      ]
    },
    "permission": {
      "scope.userLocation": {
        "desc": "您的位置信息允许“FREE出行”顺路代驾服务使用" // 高速公路行驶持续后台定位
      }
    }
  }
  
  componentDidMount () {
    Taro.getUpdateManager()
    Taro.getSystemInfo({
        success: res => {
            let statusBarHeight = res.statusBarHeight;
            setGlobalData('navHeight',statusBarHeight)
        },
        fail(err) {
          console.log(err);  
        }
    });
  }

  componentDidShow () {
    
  }

  componentDidHide () {}

  componentDidCatchError () {}

  // 在 App 类中的 render() 函数没有实际作用
  // 请勿修改此函数
  render () {
    return (
      <Provider store={store}>
        <Index />
      </Provider>
    )
  }
}

Taro.render(<App />, document.getElementById('app'))